<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: stone
  Date: 2019-08-15
  Time: 14:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" href="../image/favicon.ico" type="image/ico"/>

    <title>贵美后台管理系统</title>

    <!-- Bootstrap -->
    <link href="../css/bootstrapcss/bootstrap.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="../css/vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="../css/vendors/nprogress/nprogress.css" rel="stylesheet">
    <!-- iCheck -->
    <link href="../css/vendors/iCheck/skins/flat/green.css" rel="stylesheet">

    <!-- bootstrap-progressbar -->
    <link href="../css/vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
    <!-- JQVMap -->
    <link href="../css/vendors/jqvmap/dist/jqvmap.min.css" rel="stylesheet"/>
    <!-- bootstrap-daterangepicker -->
    <link href="../css/vendors/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">

    <!-- FooTable -->
    <link href="../css/plugins/footable/footable.core.css" rel="stylesheet">

    <link href="../css/style.css" rel="stylesheet">

    <link href="../css/plugins/datapicker/datepicker3.css" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="../css/build/css/custom.min.css" rel="stylesheet">

    <link href="../css/font-awesome/css/font-awesome.css" rel="stylesheet">

    <link href="../css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="../css/animate.css" rel="stylesheet">


</head>

<body class="nav-md">
<div class="container body">
    <div class="main_container">

        <jsp:include page="left.jsp"/>

        <!-- top navigation -->
        <jsp:include page="top.jsp"/>
        <!-- /top navigation -->

        <!-- page content -->


        <div class="right_col" role="main">


            <div class="wrapper wrapper-content animated fadeInRight ecommerce">
                <form action="../saleProd/select.do" method="post">
                <div class="ibox-content m-b-sm border-bottom">
                    <div class="row">
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="order_id">ID</label>
                                <input type="text" id="order_id" name="id" value="" placeholder="请输入ID" class="form-control">
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="status">商品编号</label>
                                <input type="text" id="status" name="prodNo" value="" placeholder="请输入商品编号" class="form-control">
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="customer">卖家</label>
                                <input type="text" id="customer" name="salerId" value="" placeholder="请输入卖家" class="form-control">
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="customer">一口价</label>
                                <input type="text" id="price" name="price" value="" placeholder="请输入一口价" class="form-control">
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="date_added">开始售卖时间</label>
                                <div class="input-group date">
                                    <span class="input-group-addon"><i class="fa fa-calendar"></i>
                                    </span><input id="date_added" type="date" class="form-control" name="starTime" >
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="date_modified">结束售卖时间</label>
                                <div class="input-group date">
                                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                    <input id="date_modified" type="date" class="form-control" name="endTime" >
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="start_number">起始数量</label>
                                <input type="text" id="start_number" name="starQuantity" value="" placeholder="请输入起始数量" class="form-control">
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="end_number">结束数量</label>
                                <input type="text" id="end_number" name="endQuantity" value="" placeholder="请输入结束数量" class="form-control">
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="carriage">运费</label>
                                <input type="text" id="carriage" name="carriage" value="" placeholder="请输入运费" class="form-control">
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="prodSkin">商品类型</label>
                                <input type="text" id="prodSkin" name="prodSkin" value="" placeholder="请输入商品类型" class="form-control">
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="location">所在地</label>
                                <input type="text" id="location" name="location" value="" placeholder="请输入所在地" class="form-control">
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                                <label class="control-label" for="amount">状态</label>
                                <input type="text" id="amount" name="status" value="" placeholder="请输入状态" class="form-control">
                            </div>
                        </div>
                    </div>

                    <div class="row" style="margin-top: 10px">
                        <div class="col-sm-12 text-center">
                            <button type="submit" class="btn btn-info btn-sm">开始搜索</button>
                        </div>
                    </div>

                </div>
                 </form>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="ibox">
                            <div class="ibox-content" style="padding: 10px 20px 0px 20px">
                                <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
                                    <thead>
                                    <tr>
                                        <%--<th>Order ID</th>--%>
                                        <th data-hide="phone">ID</th>
                                        <th data-hide="phone">商品名称</th>
                                        <th data-hide="phone">卖家</th>
                                        <th data-hide="phone,tablet" >商品数量</th>
                                        <th data-hide="phone" >一口价</th>
                                        <th data-hide="phone" >运费</th>
                                        <th data-hide="phone" >开始售卖时间</th>
                                        <th data-hide="phone" >结束售卖时间</th>
                                        <th data-hide="phone" >商品类型</th>
                                        <th data-hide="phone" >所在地</th>
                                        <th class="text-right">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                        <c:forEach var="saleProd" items="${requestScope.saleProdList}">
                                            <tr id="${saleProd.id}">
                                        <td>${saleProd.id}</td>
                                        <td>${saleProd.product.prodName}</td>
                                        <td>${saleProd.guimeiUsers.loginName}</td>
                                        <td>${saleProd.stock.quantity}</td>
                                        <td><fmt:formatNumber value="${saleProd.realPrice}" type="currency"/></td>
                                        <td>${saleProd.carriage} </td>
                                        <td>${saleProd.starTime}</td>
                                        <td>${saleProd.endTime} </td>
                                        <td>${saleProd.prodSkin}</td>
                                        <td>${saleProd.location}</td>

                                        <td class="text-right">
                                            <div class="btn-group">
                                                <button class="btn-white btn btn-xs demo4" saleId="${saleProd.id}">下架</button>
                                            </div>
                                        </td>
                                    </tr>
                                        </c:forEach>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="10" class="text-right">
                                            <c:if test="${ not saleProdPage.first}">
                                                <a href="../saleProd/select.do?pageNo=1">第一页</a>
                                            </c:if>
                                            <c:if test="${saleProdPage.pageNo gt 1}">
                                                <a href="../saleProd/select.do?pageNo=${saleProdPage.pageNo-1}">上一页</a>
                                            </c:if>
                                            <c:if test="${saleProdPage.pageNo lt saleProdPage.totalPage}">
                                                <a href="../saleProd/select.do?pageNo=${saleProdPage.pageNo+1}">下一页</a>
                                            </c:if>
                                            <c:if test="${ not saleProdPage.last}">
                                                <a href="../saleProd/select.do?pageNo=${saleProdPage.lastIndex}">最后一页</a>
                                            </c:if>
                                            <c:if test="${ not empty saleProdPage}">
                                                <a>&nbsp;&nbsp;&nbsp;总共${saleProdPage.totalRow}条记录；第${saleProdPage.pageNo}页/总共${saleProdPage.totalPage}页</a>
                                            </c:if>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>


        <!-- /page content -->

        <!-- footer content -->
        <%--<footer>--%>
        <%--<div class="pull-right">--%>
        <%--Gentelella - Bootstrap Admin Template by <a href="https://colorlib.com">Colorlib</a>--%>
        <%--</div>--%>
        <%--<div class="clearfix"></div>--%>
        <%--</footer>--%>
        <!-- /footer content -->
    </div>
</div>

<script src="../js/jquery-2.2.4.js"></script>
<script src="../js/bootstrap.js"></script>
<!-- Mainly scripts -->
<script src="../js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="../js/plugins/slimscroll/jquery.slimscroll.min.js"></script>

<!-- Custom and plugin javascript -->
<script src="../js/inspinia.js"></script>
<script src="../js/plugins/pace/pace.min.js"></script>

<!-- Sweet alert -->
<script src="../js/plugins/sweetalert/sweetalert.min.js"></script>

<script>
    // 删除弹出框
    $('.demo4').click(function () {

        // 获取a中empno属性的值
        var saleId=$(this).attr('saleId');
        //console.log($(this).attr('prodNo'));
        swal({
                title: "是否下架?",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                closeOnConfirm: false,
                closeOnCancel: false },
            function (isConfirm) {
                if (isConfirm) {
                    del(saleId);
                    swal("已下架", "ID号为："+saleId+"的在售商品已经成功下架", "success");
                } else {
                    swal("取消", "该商品"+saleId+"信息删除操作被取消)", "error");
                }
            });
    });

    // 删除操作
    function del(sale_id) {
        // 通过get发送信息到doDelete
        $.get('../saleProd/doDelete.do',{id:sale_id},
            function (res) {
                if (res.result){
                    console.log(res.result);
                    $("#"+sale_id).remove();
                }
            },'json')
    }
</script>


<%--<!-- jQuery -->
<script src="../js/jquery-2.2.4.js"></script>
<!-- Bootstrap -->
<script src="../js/bootstrap.js"></script>--%>
<!-- FastClick -->
<script src="../css/vendors/fastclick/lib/fastclick.js"></script>
<!-- NProgress -->
<script src="../css/vendors/nprogress/nprogress.js"></script>
<!-- Chart.js -->
<script src="../css/vendors/Chart.js/dist/Chart.min.js"></script>
<!-- gauge.js -->
<script src="../css/vendors/gauge.js/dist/gauge.min.js"></script>
<!-- bootstrap-progressbar -->
<script src="../css/vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
<!-- iCheck -->
<script src="../css/vendors/iCheck/icheck.min.js"></script>
<!-- Skycons -->
<script src="../css/vendors/skycons/skycons.js"></script>
<!-- Flot -->
<script src="../css/vendors/Flot/jquery.flot.js"></script>
<script src="../css/vendors/Flot/jquery.flot.pie.js"></script>
<script src="../css/vendors/Flot/jquery.flot.time.js"></script>
<script src="../css/vendors/Flot/jquery.flot.stack.js"></script>
<script src="../css/vendors/Flot/jquery.flot.resize.js"></script>
<!-- Flot plugins -->
<script src="../css/vendors/flot.orderbars/js/jquery.flot.orderBars.js"></script>
<script src="../css/vendors/flot-spline/js/jquery.flot.spline.min.js"></script>
<script src="../css/vendors/flot.curvedlines/curvedLines.js"></script>
<!-- DateJS -->
<script src="../css/vendors/DateJS/build/date.js"></script>
<!-- JQVMap -->
<script src="../css/vendors/jqvmap/dist/jquery.vmap.js"></script>
<script src="../css/vendors/jqvmap/dist/maps/jquery.vmap.world.js"></script>
<script src="../css/vendors/jqvmap/examples/js/jquery.vmap.sampledata.js"></script>
<!-- bootstrap-daterangepicker -->
<script src="../css/vendors/moment/min/moment.min.js"></script>
<script src="../css/vendors/bootstrap-daterangepicker/daterangepicker.js"></script>

<!-- Custom Theme Scripts -->
<script src="../css/build/js/custom.min.js"></script>


<!-- Custom and plugin javascript -->
<script src="../js/inspinia.js"></script>
<script src="../js/plugins/pace/pace.min.js"></script>

<!-- Data picker -->
<script src="../js/plugins/datapicker/bootstrap-datepicker.js"></script>

<!-- FooTable -->
<script src="../js/plugins/footable/footable.all.min.js"></script>

<!-- Page-Level Scripts -->
<script>
    $(document).ready(function() {

        $('.footable').footable();

        $('#date_added').datepicker({
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            calendarWeeks: true,
            autoclose: true
        });

        $('#date_modified').datepicker({
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            calendarWeeks: true,
            autoclose: true
        });

    });

</script>




</body>
</html>
